package cn.sc.summer.constant.service;

import cn.hutool.core.util.ObjectUtil;

import java.io.Serializable;

/**
 * API information is supported to determine the types of data sources supported by this class
 *
 * @author a-xin
 * @date 2024/8/28 13:24
 */
public interface Supports<T> extends Serializable {

    /**
     * Determine the types of data sources supported by this class
     *
     * @return Supported types
     */
    T supports();

    /**
     * Obtain information about the currently supported data sources
     *
     * @return Supported types
     */
    default T getSupports() {
        return this.supports();
    }

    /**
     * Verify that the data is valid and supported
     *
     * @param check Verification values
     * @return Yes or no
     */
    default Boolean checkSupports(T check) {
        return ObjectUtil.equal(getSupports(), check);
    }

}
